package cn.tedu.charging.user.controller;

import cn.tedu.charging.user.pojo.vo.VehicleVO;
import cn.tedu.charging.user.service.VehicleService;
import cn.tedu.common.pojo.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("/user")
public class VehicleController {
    private VehicleService vehicleService;
    public VehicleController(VehicleService vehicleService) {
        this.vehicleService = vehicleService;
    }
    @GetMapping("/vehicle/{userId}")
    public JsonResult<VehicleVO> listUserVehicles(@PathVariable("userId") Integer userId){
        log.debug("入参{}",userId);
        List<VehicleVO> vehicles=vehicleService.listUserVehicles(userId);
        log.debug("出参{}",vehicles);
        return JsonResult.ok(vehicles);
    }
}
